/*
@author: Pablo Weremczuk
Comments: This class holds the dialogs collection for each actor.
Basically are all arrays. Each Actor has an entry in the dialogs
array. You get the array of dialogs related with an actor and fill with
it the dialog menu.
*/
class DialogueEngine.DialogHandler{
	private var oDialogsArray:Array;
	/**
	 *
	 * @author pweremczuk
	 */
	public function DialogHandler() {
		oDialogsArray = new Array;
		addToicoDialog();
	}
	/*
	addActorDialog(psActorName:String, poDialogArray:Array)
	Parameters:
		psActorName: Is the name of the actor. Used as index in the array instead of numbers.
		poDialogArray: Is the array of dialogNodes wich fills the dialog menu.
	*/
	public function addActorDialog(psActorName:String, poDialogArray:Array){
		oDialogsArray[psActorName] = poDialogArray;
	}
	/*
	 getActorOptions(psActorName:String):Object
	 Return the options of matching the actorName passed as paramenter
	 Used for fill the dielogMenu
	*/
	public function getActorOptions(psActorName:String):Array{
		return oDialogsArray[psActorName];
	}
	/*
	TO CUSTOMIZE
	HERE DOWN GOES ALL THE GAME DIALOG. YOU MUST ADD THE COMPLETE FUNCTIONS AND
	DIALOGS FOR THE CHARACTERS. MAYBE IN A FUTURE THIS WILL CHANGE, FOR NOW, THIS WORKS
	*/
	private function addToicoDialog(){
		var aDialog:Array;
		aDialog = new Array({dialog:"ARRRG, my nombre es guybrush treepwood, y quiero ser pirata",  action:guyBrushAction}, {dialog:"Bien, adios", action:exitAction});
		function guyBrushAction(oColumn:Object) {
			_global.SCUMMGame.currentScene.addSpeak(_global.SCUMMGame.currentScene.mainActor,
													new Array(oColumn));
			_global.SCUMMGame.currentScene.addSpeak(_global.Toico,
													new Array("Vete a freir!!"));
			_global.SCUMMGame.currentScene.addSpeak(_global.SCUMMGame.currentScene.mainActor,
													new Array("DESAFIAS AL GRAN GUYBRUSH?!??!?!"));
			_global.SCUMMGame.currentScene.addSpeak(_global.Toico,
													new Array("Que te dejes de molestar tio!!"));		
		};
		function exitAction(oColumn:Object) {
			_global.SCUMMGame.currentScene.mainActor.say(new Array(oColumn));
			_global.SCUMMGame.setModeExploring();
		};
		addActorDialog("Toico", aDialog);
	}
}